package com.example.speeddating.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.speeddating.entity.Report;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;

/**
 * @author tina
 * @since 2023-06-28 11:14:34
 */
@Mapper
public interface ReportMapper extends BaseMapper<Report> {

    @Results({
            @Result(column = "id", property = "id"),
            @Result(column = "user_id", property = "userId"),
            @Result(column = "article_id", property = "articleId"),
            @Result(column = "type_id", property = "typeId"),
            @Result(column = "type_id",property = "reportType",one = @One(select = "com.example.speeddating.mapper.ReportTypeMapper.selectReportTypeById")),
            @Result(column = "user_id",property = "user",
                    one = @One(select = "com.example.speeddating.mapper.UserMapper.selectByUserId")),
            @Result(column = "article_id", property = "article",
                    one = @One(select = "com.example.speeddating.mapper.ArticleMapper.selectArticleById")),
    })
    @Select("select * from report")
    Page<Report> selectAllReport(Page<Report> reportPage);
}
